﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SingletonPattern
{
    /// <summary>
    /// 懒汉式，线程不安全
    /// </summary>
    public class Singleton1
    {
        private static Singleton1 instance;

        private Singleton1() { }

        private static Singleton1 GetInstance()
        {
            if (instance == null)
            {
                instance = new Singleton1();
            }

            return instance;
        }
    }
}
